package com.shengyuan.manage_os.old.ying.erpm.tasks;

import org.json.JSONArray;

import com.shengyuan.manage_os.old.ying.boce.http.HttpException;
import com.shengyuan.manage_os.old.ying.boce.task.GenericTask;
import com.shengyuan.manage_os.old.ying.boce.task.TaskParams;
import com.shengyuan.manage_os.old.ying.boce.task.TaskResult;
import com.shengyuan.manage_os.old.ying.erpm.MainApplication;

public class Submit_System_Setting_Data_Task extends GenericTask {
	
	public static final String TYPECODE="TypeCode", TYPENAME="TYPENAME", FIELD ="Field";
	public static final String S_LIXIAN = "S_LIXIAN";
	public static final String T_ZIYOUJIXIE = "T_ZIYOUJIXIE", T_CHEXING="T_CHEXING", T_BiaoDan="T_BiaoDan", T_YuSuanJiaGe="T_YuSuanJiaGe", T_CaiLiaoJiaGe="T_CaiLiaoJiaGe";
	public static final String T_WAIZUJIXIE = "T_WAIZUJIXIE";
	public static final String T_ZIYOUSHILUN = "T_ZIYOUSHILUN", T_WAIZUSHILUN="T_WAIZUSHILUN";
	public static final String T_GONYINGSHANG = "T_GONYINGSHANG";
	public static final String T_ERPUSER = "T_ERPUSER", T_DIDIAN="T_DIDIAN",  T_SIJI="T_SIJI",  T_ALLCHEPAI="T_ALLCHEPAI";
	
	public static final String T_GONGCHENGMINGCHENG_GC = "T_GONGCHENGMINGCHENG_GONGCHENG",  T_GONGCHENGMINGCHENG_BAOXIAO = "T_GONGCHENGMINGCHENG_BAOXIAO", 
			T_GONGCHENGMINGCHENG_JX = "T_GONGCHENGMINGCHENG_JX", T_GONGCHENGMINGCHENG_OA = "T_GONGCHENGMINGCHENG_OA", T_get_data_dakatime = "get_data_dakatime";
	public static final String T_GONGCHENGMINGCHENG_GC_XIANGMU = "T_GONGCHENGMINGCHENG_GC_XIANGMU", 
			T_GONGCHENGMINGCHENG_JX_XIANGMU = "T_GONGCHENGMINGCHENG_JX_XIANGMU", T_GONGCHENGMINGCHENG_OA_XIANGMU = "T_GONGCHENGMINGCHENG_OA_XIANGMU";	
	public static final String T_CAILIAOMINGCHENG = "T_CAILIAOMINGCHENG";
	public static final String T_ZHUANGDI = "T_ZHUANGDI";
	public static final String T_XIEDI = "T_XIEDI";
	public static final String T_FUWUXIANMU = "T_FUWUXIANMU";
	public static String T_ZONGLIANG ;
	public static String T_CHEXINGHAO ;
	public static String T_CAILIAO ;
	public static String T_SHANGJIA ;
	
	public static JSONArray J_ZIYOUJIXIE,J_WAIZUJIXIE,J_ZIYOUSHILUN,J_GONYINGSHANG, J_CHEXING;
	public static JSONArray J_GONGCHENGMINGCHENG_GC, J_GONGCHENGMINGCHENG_BAOXIAO,J_GONGCHENGMINGCHENG_JX,J_GONGCHENGMINGCHENG_OA;
	public static JSONArray J_GONGCHENGMINGCHENG_GC_XIANGMU,J_GONGCHENGMINGCHENG_JX_XIANGMU,J_GONGCHENGMINGCHENG_OA_XIANGMU;
	public static JSONArray J_CAILIAOMINGCHENG, J_ZHUANGDI, J_XIEDI,J_FUWUXIANMU;
	
	public static String[] A_ZIYOUJIXIE,A_WAIZUJIXIE,A_ZIYOUSHILUN,A_GONYINGSHANG, A_CHEXING,A_CHEPAI = new String[1];
	public static String[] A_GONGCHENGMINGCHENG_GC, A_GONGCHENGMINGCHENG_BAOXIAO,A_GONGCHENGMINGCHENG_JX,A_GONGCHENGMINGCHENG_OA;
	public static String[] A_GONGCHENGMINGCHENG_GC_XIANGMU,A_GONGCHENGMINGCHENG_JX_XIANGMU,A_GONGCHENGMINGCHENG_OA_XIANGMU;
	public static String[] A_CAILIAOMINGCHENG, A_ZHUANGDI, A_XIEDI, A_FUWUXIANMU;
	
	public static int mID= -1; //数据调度集列ID
	public JSONArray pJsonArray = null;
	public String pTypeName;
	public String mErrorMessage;
	public String sField;
	@Override
	protected TaskResult _doInBackground(TaskParams... params) {
		try {
			TaskParams param= params[0];
			String TypeName = param.getString(TYPENAME);
			String TypeCode = param.getString(TYPECODE);
			sField = param.getString(FIELD);
			pTypeName = TypeName;
			//pArrayList = new ArrayList<JSONArray>();
			pJsonArray = MainApplication.mApiErpm.Service_Get_ApplicationData( TypeName, TypeCode);
			System.out.println("##########AAAAAAAAAAAAAAA=========="+pJsonArray.toString());
			return TaskResult.OK;
		}catch (HttpException e) {
  			mErrorMessage = "网络超时异常";
			System.out.println("##########AAAAAAAAAAAAAAA=========="+e.toString());
			return TaskResult.FAILED;
		}
		catch (Exception e) {
			e.printStackTrace();
			mErrorMessage = e.getMessage();
			System.out.println("##########AAAAAAAAAAAAAAA@@@======"+e.toString());
			return TaskResult.FAILED;
		}
	}
}    